#include "junix.h"
#include <boost/ref.hpp>

using namespace std;

struct A
{
	int i;
	A(int n=0):i(n){ }
	friend ostream& operator<< (ostream& os, A const& a)
	{
		os<<a.i;
		return os;
	}
};

int main(int argc, char **argv)
{
	A a(9);
	vector<A> va;
	for( int i=0;i<10;i++)
		va.push_back( boost::ref(a) );

	a.i=88;
	copy(va.begin(),va.end(),
			ostream_iterator<A>(cout," "));
	cout<<endl;

	va.at(0).i=88;
	copy(va.begin(),va.end(),
			ostream_iterator<A>(cout," "));
	cout<<endl;
}
